<!doctype html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="/common/commonCss.jsp" />
<jsp:include page="/common/commonJs.jsp" />
<link rel="stylesheet" type="text/css"
	href="${basePath }commonCss/css/global.css">
<link rel="stylesheet" type="text/css"
	href="${basePath }commonCss/css/layout.css">
<link rel="stylesheet" type="text/css"
	href="${basePath }commonCss/css/easyui.css">
<script src="${basePath }commonJs/jquery.min.js"></script>
<script src="${basePath }commonJs/jquery.easyui.min.js"></script>
<script src="${basePath }commonJs/jt_normal.js"></script>
<script src="${basePath }commonJs/jt_select.js"></script>
<script type="text/javascript" src="${basePath }commonJs/tags/page/page.js"></script>
<script language="javascript" src="${basePath }commonJs/tags/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" src="${basePath }commonJs/verify.js"></script>

<title>嘉童游乐中心-限时打折</title>
<script type="text/javascript">
	
	var userId = "${pkusrid}";
	var path = "${basePath }";
	jQuery(document).ready(function() {
		seacheHome();
		
	});
	/**条件查询数据*/
	function seacheHome() {
		var form = $("#form_home");
		var pagebean = new PageBean(form);
		pagebean.setTableId("home_table");
		pagebean.setCallback(seacheHomeCall);
		pagebean.setFootId("home_page");
		setPagebeanObj(pagebean);
		pagebean.doPage();
	}
	/**条件查询数据 回调事件*/
	function seacheHomeCall(data) {
		$
				.each(
						data,
						function(i, obj) {
							/**查看*/
							var show = "<a href=\"#\" onClick=\"javascript:window.location.href='${basePath }promotionWorkFlow/seacheByCampIdWfHis.shtml?pkCampId="
									+ obj.pkCampId+ "&fkBranId="+obj.fkBranId+"'\">"
									+ obj.pkCampId
									+ "</a>";
							var showEdit = "<a href=\"#\" onClick=\"javascript:window.location.href='${basePath }promotion/seacheByCampId.shtml?pkCampId="
									+ obj.pkCampId
									+ "'\">"
									+ obj.pkCampId
									+ "</a>";

							/**编辑*/
							var option_edit = "<input type=\"button\" class=\"btn_l\" value=\"编辑\" onClick=\"javascript:window.location.href='${basePath }promotion/seacheByCampId.shtml?pkCampId="
									+ obj.pkCampId + "'\">";

							/**编辑、删除*/
							var option_edit_del = option_edit
									+ "<input type=\"button\" class=\"btn_l ml10\" value=\"删除\" onClick=\"javascript:del_promotion('"
									+ obj.pkCampId + "')\">";

							/**处理*/
							var option_handle = "<input type=\"button\" class=\"btn_l\" value=\"处理\" onClick=\"javascript:window.location.href='${basePath }promotionWorkFlow/seacheByCampIdWf.shtml?pkCampId="
									+ obj.pkCampId + "&fkBranId="+obj.fkBranId+"'\">";

							/**退回处理重新提交*/
							var option_handle_re = "<input type=\"button\" class=\"btn_l\" value=\"重新申请\" onClick=\"javascript:window.location.href='${basePath }promotionWorkFlow/seacheByCampIdExtHome.shtml?pkCampId="
									+ obj.pkCampId + "'\">";
							var tr = "<tr>" + "<td>"
									+ (i + 1)
									+ "</td>"
									+ "<td class=\"lv\">_no_</td>"
									+ "<td>"
									+ obj.campName
									+ "</td>"
									+ "<td>"
									+ obj.startDateStr
									+ "</td>"
									+ "<td>"
									+ obj.endDateStr
									+ "</td>"
									+ "<td>"
									+ obj.userName
									+ "</td> "
									+ "<td>"
									+ obj.overdue
									+ "</td>"
									+
									/* "<td>"+obj.statusStr+"</td>"+
									"<td>"+obj.statusCheck+"</td>"+ */
									"<td>"
									+ (obj.workflowVo.statusDesc == null ? ""
											: obj.workflowVo.statusDesc)
									+ "</td>"
									+ "<td>"
									+ (obj.workflowVo.result == null ? ""
											: obj.workflowVo.result) + "</td>"
									+ "<td>_option_</td>" + "</tr>";
							/**草稿  - 编辑、删除  只有本人可操作*/
							if (obj.status == 1 && obj.modiBy == userId) {
								tr = tr.replace("_option_", option_edit_del);
								tr = tr.replace("_no_", showEdit);

							}
							/**审核中    - 处理*/
							else if (obj.status == 2) {
								tr = tr.replace("_no_", show);
								if (obj.workflowVo.isCurrtOpt == '1'
										&& obj.workflowVo.isStartUser == '1') {
									tr = tr.replace("_option_",
											option_handle_re);
								} else if (obj.workflowVo.isCurrtOpt == '1'
										&& obj.workflowVo.isStartUser != '1') {
									tr = tr.replace("_option_", option_handle);
								} else {
									tr = tr.replace("_option_", "");
								}

							} else if (obj.status == 3) {
								tr = tr.replace("_option_", "");
								tr = tr.replace("_no_", show);
							} else if (obj.status == 4) {
								tr = tr.replace("_option_", "");
								tr = tr.replace("_no_", show);
							}
							/**退回    - 只能编辑
							else if( obj.status == 2 ){
							   tr = tr.replace("_option_", option_edit);
							}*/
							else {
								tr = tr.replace("_option_", "");
								tr = tr.replace("_no_", showEdit);
							}
							$("#home_table").append(tr);
						});

	}

	function del_promotion(id) {
		$.messager.confirm('提示', '确认要删除吗?', function(r) {
			if (r) {
				$.ajax({
					url : "${basePath }promotion/deleteProCampaign.shtml",
					data : "pkCampId=" + id,
					dataType : 'json',
					type : 'POST',
					success : function(data) {
						seacheHome();
						alertInfo($common_delete_success);
					}
				});
			}
		});
	}
</script>
</head>
<body class="bg">
	<div class="content m_auto">
		<div class="content_l mt10">
			<ul>
				<shiro:hasPermission name="promotion/home.shtml">
					<li class="content_hover"><a
						href="${basePath }promotion/home.shtml"><i class="nav_icon_b"></i><br>限时打折</a></li>
				</shiro:hasPermission>
			</ul>
		</div>

		<div class="content_r mt10">
			<div class="pt20">
				<form id="form_home" action="${basePath }promotion/homeWhere.shtml">
					<div class="file_single_dl f14 fixed">
						<dl class="fixed" style="overflow: hidden">
							<dd>
								<label>所属门店：</label>
								<!----select--->
								<div class="uboxstyle">
									<select name="fkBranId" id="fkBranId">

										<c:forEach items="${branAll }" var="bran" varStatus="cc">
											<c:choose>
												<c:when test="${branId == 'ZB' }">
													<c:if test="${bran.pkBranId !='ZB'}">
														<option value="${bran.pkBranId}">${bran.branName }</option>
													</c:if>
												</c:when>
												<c:when test="${branId != 'ZB' && branId ==bran.pkBranId }">

													<option value="${bran.pkBranId}">${bran.branName }</option>
												</c:when>

											</c:choose>
										</c:forEach>


									</select>
								</div>
							</dd>
							<dd>
								<label>活动名称：</label> <input type="text" class="iput_t w200"
									name="campName">
							</dd>
							<dd>
								<label>活动有效时间：</label> <input type="text" name="startDateStr"
									class="Wdate iput_t w82"
									onClick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,isShowClear:true,readOnly:true})">
								<span>至</span> <input type="text" name="endDateStr"
									class="Wdate iput_t w82"
									onClick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,isShowClear:true,readOnly:true})">
							</dd>

							<dd class="fr">
								<input type="button" class="btn ml10" value="查询" onclick="seacheHome()">
								<shiro:hasPermission name="promo:add">
									<input class="btn ml10" type="button" value="创建活动"
										onClick="window.location.href='${basePath }promotion/addPromotionHome.shtml'">
								</shiro:hasPermission>
							</dd>
						</dl>
						<input type="hidden" name="pageNo" value="1"> <input
							type="hidden" name="pageSize" value="15">
					</div>
				</form>
				<div class="p10">
					<table class="table" id="home_table">
						<tr>
							<th>序号</th>
							<th>活动编号</th>
							<th>活动名称</th>
							<th>活动开始时间</th>
							<th>活动结束时间</th>
							<th>活动设置人</th>
							<th>活动是否过期</th>
							<th>审批状态</th>
							<th>审批结果</th>
							<th>操作</th>
						</tr>
						<!-- <tr>
                        	<td>1</td>
                            <td class="lv"><a href="#" onClick="javascript:window.location.href='promo_activity_new_y.html'">00000124</a></td>
                            <td>万圣节促销活动</td>
                            <td>2014-10-31</td>
                            <td>2014-10-31</td>
                            <td>jack</td> 
                            <td>否</td>
                            <td>总监审批</td>
                            <td></td>
                            <td><input type="button" class="btn_l" value="处理" onClick="javascript:window.location.href='promo_activity_new_x.html'"></td>
                        </tr>
                        <tr>
                        	<td>2</td>
                            <td class="lv"><a href="#" onClick="javascript:window.location.href='promo_activity_new_y.html'">00000124</a></td>
                            <td>万圣节促销活动</td>
                            <td>2014-10-31</td>
                            <td>2014-10-31</td>
                            <td>jack</td> 
                            <td>否</td>
                            <td>完成</td>
                            <td>通过</td>
                            <td></td>
                        </tr>
                        <tr>
                        	<td>3</td>
                            <td class="lv"><a href="#" onClick="javascript:window.location.href='promo_activity_new_y.html'">00000124</a></td>
                            <td>万圣节促销活动</td>
                            <td>2014-10-31</td>
                            <td>2014-10-31</td>
                            <td>jack</td> 
                            <td>否</td>
                            <td>退回</td>
                            <td></td>
                            <td><input type="button" class="btn_l" value="处理" onClick="javascript:window.location.href='promo_activity_new.html'"></td>
                        </tr>
                        <tr>
                        	<td>3</td>
                            <td class="lv"><a href="#" onClick="javascript:window.location.href='promo_activity_new.html'">00000124</a></td>
                            <td>万圣节促销活动</td>
                            <td>2014-10-31</td>
                            <td>2014-10-31</td>
                            <td>jack</td> 
                            <td>否</td>
                            <td>草稿</td>
                            <td></td>
                            <td><input type="button" class="btn_l" value="编辑" onClick="javascript:window.location.href='promo_activity_new.html'"><input type="button" class="btn_l ml10" value="删除"></td>
                        </tr> -->
					</table>
				</div>
				<!---翻页-->
				<div class="page fr">
					<div class="btm_btn m10" id="home_page">
						<!--  <dl>
                                <dd>
                                    <span>第3/2000页</span>
                                    <span>首页</span>
                                    <span>上一页</span>
                                    <span><a href="#">下一页</a></span>
                                    <span><a href="#">末页</a></span>
                                    <span>跳转到<input type="text" class="black_text mlr5">页</span>
                                </dd>
                            </dl> -->
					</div>
				</div>
				<!----->
			</div>
		</div>
	</div>

</body>
</html>














